package com.ellricky.baselib.ui.msg;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;

import com.andr.common.http.util.Util;
import com.andr.common.util.ResUtil;
import com.ellricky.baselib.BaseConstant;
import com.ellricky.baselib.R;
import com.ellricky.baselib.cache.LocalCacheUtil;
import com.ellricky.baselib.ui.base.BaseTabVpFragment;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class MsgTipFragment extends BaseTabVpFragment {

    @Override
    public int getContentLayout() {
        return R.layout.base_layout_tab_vp;
    }

    public static MsgTipFragment newInstance(String type) {
        MsgTipFragment fragment = new MsgTipFragment();
        Bundle bundle = new Bundle();
        bundle.putString(BaseConstant.KEY_TYPE, type);
        fragment.setArguments(bundle);
        return fragment;
    }

    @Override
    protected void initUIView(View root) {
        super.initUIView(root);
    }

    @NonNull
    @Override
    public List<Fragment> getFragmentList() {
        Bundle bundle = getArguments();
        String type = bundle.getString(BaseConstant.KEY_TYPE);
        List<Fragment> fragments = new ArrayList<>();
        fragments.add(MsgTipChildFragment2.Companion.newInstance(type, 0));
        fragments.add(MsgTipChildFragment2.Companion.newInstance(type, 1));
        return fragments;
    }

    @NonNull
    @Override
    public List<String> getTabTitleList() {
        return Arrays.asList(ResUtil.getStrArr(mContext, R.array.base_msg_tip));
    }

    @Override
    public int getTitleRes() {
        return R.string.base_msg_tip;
    }

    @Override
    protected void onClickView(View v) {
        super.onClickView(v);
        if (v == mIbBack) Util.onInvalidToken(mContext, "");
    }
}
